﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace GenProj
{
	class GenProj
	{
		GenProjInput Input;

		public GenProj(string inputPath)
		{
			var serializer = new XmlSerializer(typeof(GenProjInput));

#if true
			var sample = new GenProjInput();
			sample.Projects = new List<GenProjProject>();
			var proj = new GenProjProject();
			proj.OutputFilename = "StarNinjaFiles.xml";
			proj.Directories = new List<GenProjDirectory>();
			var dir = new GenProjDirectory(@"..\..\..\Engine\EngineCore", "*.cs", "*.cd", null, "Copy of*");
			proj.Directories.Add(dir);
			var dir2 = new GenProjDirectory(@"..\..\..\Engine\EngineUI", "*.cs", "*.cd", null, "Copy of*");
			proj.Directories.Add(dir2);
			sample.Projects.Add(proj);
			sample.Projects.Add(proj);

			using (var stream = File.Create("Sample.xml"))
			{
				serializer.Serialize(stream, sample);
			}
#endif

			{
				using (var stream = File.OpenRead(inputPath))
				{

					Input = (GenProjInput)serializer.Deserialize(stream);
					Input.GenerateProjectXML();
				}
			}
		}
	}
}
